package com.wanger;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
public class JoinApplication {
    public static void main(String[] args) throws UnknownHostException {
        printBasicInfo(SpringApplication.run(JoinApplication.class, args));
    }

    private static void printBasicInfo(ConfigurableApplicationContext context) throws UnknownHostException {
        System.out.println("mybatis-plus-join演示项目启动成功！");
        System.out.println("swagger-ui访问地址：");
        Environment environment = context.getBean(Environment.class);
        String port = environment.getProperty("server.port");
        String address = InetAddress.getLocalHost().getHostAddress();
        String contextPath = environment.getProperty("server.servlet.context-path");
        System.out.println("\t本地访问：http://localhost:" + port + contextPath + "/swagger-ui.html");
        System.out.println("\t网络访问：http://" + address + ":" + port + contextPath + "/swagger-ui.html");
    }
}
